//
//  StatusCellBottomview.swift
//  ydy_weibo
//
//  Created by 杨德勇 on 16/7/18.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

import UIKit

class StatusCellBottomview: UIView {
    
    
    
    //MARK:-
    //MARK:点击事件
    
    @objc private func retweetedBtnDidClick(){
        let retweetedVC = RetweetedBtnViewContreoller()
        
        retweenedBtn.navController()?.pushViewController(retweetedVC, animated: true)
        
    }

    
    
    //MARK:-
    //MARK:3.init
    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor(white: 0.8, alpha: 1)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    
    
    //MARK:-
    //MARK:2.setupUI
    private func setupUI(){
        //分割线属性
        let w:CGFloat = 1.5
        let scale = 0.4
        
        addSubview(retweenedBtn)
        addSubview(composeBtn)
        addSubview(likeBtn)
        
        retweenedBtn.snp_makeConstraints { (make) in
            make.left.equalTo(snp_left)
            make.top.equalTo(snp_top)
            make.height.equalTo(snp_height)
        }
        //添加分割线1
        let sepView1 = self.sepView()
        addSubview(sepView1)
        
        sepView1.snp_makeConstraints { (make) in
            make.left.equalTo(retweenedBtn.snp_left)
            make.height.equalTo(retweenedBtn.snp_height).multipliedBy(scale)
            make.width.equalTo(w)
            make.centerY.equalTo(snp_centerY)
        
        }
        
        
        composeBtn.snp_makeConstraints { (make) in
            make.left.equalTo(sepView1.snp_left)
            make.top.equalTo(snp_top)
            make.height.equalTo(snp_height)
            make.width.equalTo(retweenedBtn.snp_width)
            
        }
        
        let sepview2 = sepView()
        addSubview(sepview2)
        sepview2.snp_makeConstraints { (make) in
            make.left.equalTo(composeBtn.snp_right)
            make.width.equalTo(w)
            make.height.equalTo(composeBtn.snp_height).multipliedBy(scale)
            make.top.equalTo(retweenedBtn.snp_top)
            make.centerY.equalTo(snp_centerY)
        }
        
        likeBtn.snp_makeConstraints { (make) in
            make.left.equalTo(sepview2.snp_right)
            make.top.equalTo(composeBtn.snp_top)
            make.right.equalTo(snp_right)
            make.width.equalTo(composeBtn.snp_width)
        }
        //添加点击事件
        retweenedBtn.addTarget(self, action: #selector(self.retweetedBtnDidClick), forControlEvents: .TouchUpInside)
        
        
    }
    private func sepView()->(UIView){
        let v = UIView()
        v.backgroundColor = UIColor.darkGrayColor()
        return v
    }

    
    //MARK:-
    //MARK:1.懒加载控件
    private lazy var retweenedBtn :UIButton = UIButton(title: "转发", backimg: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_retweet", fontsize: 10)
    
    private lazy var composeBtn :UIButton = UIButton(title: "评论", backimg: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_comment", fontsize: 10)
    
    private lazy var likeBtn: UIButton = UIButton(title: "赞", backimg: nil, color: UIColor.darkGrayColor(), image: "timeline_icon_unlike", fontsize: 10)


}
